﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasierRdp.Util
{
    static class StringExtesion
    {
        public static int? ParseNullableInt(this string src)
        {
            var value = 0;
            if(int.TryParse(src, out value))
            {
                return value;
            }
            return null;
        }

        public static bool IsNullOrEmpty(this string src)
        {
            return String.IsNullOrEmpty(src);
        }

        public static string ToBase64String(this string src)
        {
            return Convert.ToBase64String(Encoding.UTF8.GetBytes(src));
        }

        public static string FromBase64String(this string src)
        {
            return Encoding.UTF8.GetString(Convert.FromBase64String(src));
        }
        
    }
}
